import userModel from "../model/user/index";
export default {
    namespaced: true,

    state: {
        userlist: [],
        total: 0,

    },
    mutations: {
        inituserlist(state, list) {
            state.userlist = list
        },
        inittotal(state, total) {
            state.total = total
        }
    },
    actions: {
        async inituserlist({ commit }, payload) {
            let data = await userModel.userlist(payload)
            let list = data.data.list;
            let total = data.data.count
                // console.log(list);
                // console.log(total);
                // list = list.filter(item => item.type !== 1)
            commit("inituserlist", list)
            commit("inittotal", total)
        },
        async deleteuser({ commit }, payload) {
            await userModel.deleteuser(payload)
                // console.log(info);
                // let data = await userModel.userlist()
                // let list = data.data.list;

            // list = list.filter(item => item.type !== 1)
            // commit("inituserlist", list)

        },
        async adduser({ commit }, info) {
            let data = await userModel.adduser(info)
                // console.log(data.data.msg);
            return data
        }

    }

}